package cn.edu.cqu.fredyvia.forum.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
@Configuration
public class BeanFactory {
    @Autowired
    AliyunOssConfig aliyunOssConfig;
    @Bean
    public PasswordEncoder passwordEncoder(){
        return new BCryptPasswordEncoder(5);
    }

    @Bean
    OSS getOssClient(){
        return new OSSClientBuilder().build(aliyunOssConfig.getEndpoint(), aliyunOssConfig.getKeyid(), aliyunOssConfig.getKeysecret());
    }
}
